package com.ftqh.tutorial.security.repository;

import com.ftqh.tutorial.security.entity.User;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

/**
 * Created by Administrator on 2016/12/27.
 */
public interface UserRepository extends JpaRepository<User, Integer> {

    @EntityGraph(value = "User.detail", type = EntityGraph.EntityGraphType.LOAD)
    Optional<User> findByUsername(String username);

}
